#include "Hadamard.h"
#include<vector>
#include<string>
#include"function.h"
using namespace std;

Hadamard::Hadamard(void)
{
}


Hadamard::~Hadamard(void)
{
}

vector<string> Hadamard::get(int n)
{
	if(n<0)
		throw msg("Hadamard::get(int n) parameter n is invalid");
	vector<string> hadamard;
	if(n==0)
	{
		hadamard.push_back("1");
		return hadamard;
	}

	vector<string> sub(get(n-1));
	for(auto &str:sub)
		hadamard.push_back(str+str);
	for(auto &str:sub)
	{
		string str2;
		for(auto &c:str)
		{
			if(c=='1')
				str2+='0';
			else
				str2+='1';
		}
		hadamard.push_back(str+str2);
	}
	//for(auto &e:hadamard)
		//cout<<e<<endl;
	return hadamard;

}
